<template>
  <div>
    <!-- <div class="toptitle">角色列表</div> -->
    <el-row id="order_total">
      <el-col style="display:flex">
        <div
          class="order_content"
          :span="8"
          v-for="(item, index) in items"
          :key="index"
          @click="mouseEnter(index)"
          :class="{ active: index == isActive }"
        >
          <div
            class="order_total_title"
            style="height:120px;line-height:120px;"
          >
            {{ item }}
          </div>
          <!-- <div class="order_total_info">
            <span class="order_data">{{ totalData.total }}</span>
          </div> -->
        </div>
      </el-col>
      <!-- <el-col :span="8">
        <div class="order_content" @click="clicktwo()">
          <div class="order_total_title"  style="height:80px;line-height:80px;">营销区域排名</div> -->
      <!-- <div class="order_total_info">
            <span class="order_data">{{ totalData.strongBindMemberSum }}</span>
          </div> -->
      <!-- </div>
      </el-col> -->
      <!-- <el-col :span="8">
        <div class="order_content" @click="clickthree()">
          <div class="order_total_title"  style="height:80px;line-height:80px;">店铺排名</div> -->
      <!-- <div class="order_total_info">
            <span class="order_data">{{ totalData.weakMemberSum }}</span>
          </div> -->
      <!-- </div>
      </el-col> -->
    </el-row>
    <div v-if="paiming">
      <el-form
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
        @keyup.enter.native="search()"
      >
        <!-- <el-row :span="24">
            <el-col :span="8"> -->
        <el-form-item label="大区名称">
          <br />
          <br />
          <el-input
            v-model="formInline.upOrgZone"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>
             <el-col :span="8"> -->
        <el-form-item
          style="margin-left:700px;text-align:right;margin-top:30px"
        >
          <el-button
            type="primary"
            @click="kong()"
            size="mini"
            icon="el-icon-delete"
            >清空</el-button
          >
          <!-- </el-form-item>
      <el-form-item> -->
          <el-button
            type="primary"
            @click="search()"
            size="mini"
            icon="el-icon-search"
            >查询</el-button
          >
          <!-- </el-form-item>
       <el-form-item> -->
          <el-button
            type="success"
            @click="exportExcel()"
            size="mini"
            icon="el-icon-s-data"
            >导出</el-button
          >
        </el-form-item>
        <!-- </el-col>
    
        </el-row> -->
      </el-form>
      <div>
        <!-- <el-table
        :data="tableData"
        border
        style="width: 100%;"
          v-loading="loading"
        :header-cell-style="{background:'#ebecf0',color:'#606266'}"
      > -->
        <el-table
          :data="tableData"
          border
          row-key="id"
          align="left"
          id="colone"
          @sort-change="handleSortone"
        >
          <el-table-column
            v-for="(item, index) in colone"
            :key="`colone${index}`"
            :prop="dropColone[index].prop"
            :width="dropColone[index].width"
            :label="item.label"
            :sortable="item.sortable"
          >
          </el-table-column>
          <!-- <el-table-column prop="grade" label="排名" align="left" width="60"></el-table-column>
          <el-table-column prop="upOrgZone" label="大区名称" align="left" ></el-table-column>
        <el-table-column prop="activityCardDownloadCount" label="活动名片下载次数" align="left" ></el-table-column>

          <el-table-column prop="goodsCardDownloadCount" label="商品名片下载次数" align="left"></el-table-column>
       
        <el-table-column prop="storeCardDownloadCount" label="店铺名片下载次数" align="left" ></el-table-column>
         <el-table-column prop="sumCount" label="总下载次数" align="left" ></el-table-column> -->
        </el-table>

        <div class="block" style="margin-top:10px">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30, 50, 100]"
            :current-page="listQuery.current"
            :page-size="listQuery.size"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>

    <div v-if="paimingone">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <!-- <el-row :span="24">
            <el-col :span="8"> -->
        <el-form-item label="营销区域名称">
          <br />
          <br />
          <el-input
            v-model="formInline.baseName"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>
            <el-col :span="8"> -->
        <el-form-item label="大区名称">
          <br />
          <br />
          <el-input
            v-model="formInline.upOrgZone"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>
             <el-col :span="8"> -->
        <el-form-item style="margin-left:700px;text-align:right;">
          <el-button
            type="primary"
            @click="kongone()"
            size="mini"
            icon="el-icon-delete"
            >清空</el-button
          >
          <!-- </el-form-item>
      <el-form-item> -->
          <el-button
            type="primary"
            @click="searchone()"
            size="mini"
            icon="el-icon-search"
            >查询</el-button
          >
          <!-- </el-form-item>
       <el-form-item> -->
          <el-button
            type="success"
            @click="exportExcelone()"
            size="mini"
            icon="el-icon-s-data"
            >导出</el-button
          >
        </el-form-item>
        <!-- </el-col>
    
        </el-row> -->
      </el-form>
      <div>
        <!-- <el-table
        :data="tableData"
        border
        style="width: 100%;"
          v-loading="loading"
        :header-cell-style="{background:'#ebecf0',color:'#606266'}"
      > -->
        <el-table
          :data="tableData"
          border
          row-key="id"
          align="left"
          id="coltwo"
          @sort-change="handleSorttwo"
        >
          <el-table-column
            v-for="(item, index) in coltwo"
            :key="`coltwo${index}`"
            :prop="dropColtwo[index].prop"
            :width="dropColtwo[index].width"
            :label="item.label"
            :sortable="item.sortable"
          >
          </el-table-column>
          <!-- <el-table-column prop="grade" label="排名" align="left" width="60"></el-table-column>
         <el-table-column prop="upOrgZone" label="大区名称" align="left" ></el-table-column>
          <el-table-column prop="baseName" label="营销区域名称" align="left" ></el-table-column>
        <el-table-column prop="activityCardDownloadCount" label="活动名片下载次数" align="left" ></el-table-column>

          <el-table-column prop="goodsCardDownloadCount" label="商品名片下载次数" align="left"></el-table-column>
       
        <el-table-column prop="storeCardDownloadCount" label="店铺名片下载次数" align="left" ></el-table-column>
         <el-table-column prop="sumCount" label="总下载次数" align="left" ></el-table-column> -->
        </el-table>

        <div class="block" style="margin-top:10px">
          <el-pagination
            @size-change="handleSizeChangeone"
            @current-change="handleCurrentChangeone"
            :page-sizes="[10, 20, 30, 50, 100]"
            :current-page="listQueryone.current"
            :page-size="listQueryone.size"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>

    <div v-if="paimingtwo">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <!-- <el-row :span="24">
            <el-col :span="8"> -->
        <el-form-item label="店铺授权编码">
          <br />
          <br />
          <el-input
            v-model="formInline.authCode"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>
           <el-col :span="8"> -->
        <el-form-item label="店铺名称">
          <br />
          <br />
          <el-input
            v-model="formInline.storeName"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>
           <el-col :span="8"> -->
        <el-form-item label="大区名称">
          <br />
          <br />
          <el-input
            v-model="formInline.upOrgZone"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>
           <el-col :span="8"> -->
        <el-form-item label="营销区域名称">
          <br />
          <br />
          <el-input
            v-model="formInline.baseName"
            placeholder
            style="margin-left:-60px;width:200px"
            clearable
          ></el-input>
        </el-form-item>
        <!-- </el-col>

             <el-col :span="8"> -->
        <el-form-item
          style="margin-left:700px;text-align:right;margin-top:30px"
        >
          <el-button
            type="primary"
            @click="kongtwo()"
            size="mini"
            icon="el-icon-delete"
            >清空</el-button
          >
          <!-- </el-form-item>
      <el-form-item> -->
          <el-button
            type="primary"
            @click="searchtwo()"
            size="mini"
            icon="el-icon-search"
            >查询</el-button
          >
          <!-- </el-form-item>
       <el-form-item> -->
          <el-button
            type="success"
            @click="exportExceltwo()"
            size="mini"
            icon="el-icon-s-data"
            >导出</el-button
          >
        </el-form-item>
        <!-- </el-col>
    
        </el-row> -->
      </el-form>
      <div>
        <!-- <el-table
        :data="tableData"
        border
        style="width: 100%;"
          v-loading="loading"
        :header-cell-style="{background:'#ebecf0',color:'#606266'}"
      > -->
        <el-table
          :data="tableData"
          border
          row-key="id"
          align="left"
          @sort-change="handleSort"
        >
          <el-table-column
            v-for="(item, index) in col"
            :key="`col_${index}`"
            :prop="dropCol[index].prop"
            :width="dropCol[index].width"
            :label="item.label"
            :sortable="item.sortable"
          >
          </el-table-column>
          <!-- <el-table-column prop="grade" label="排名" align="left" width="60"></el-table-column>
         <el-table-column prop="upOrgZone" label="大区名称" align="left" ></el-table-column>
          <el-table-column prop="baseName" label="营销区域名称" align="left" ></el-table-column>

            <el-table-column prop="authCode" label="店铺授权编码" align="left" ></el-table-column>
          <el-table-column prop="storeName" label="店铺名称" align="left" ></el-table-column>
        <el-table-column prop="activityCardDownloadCount" label="活动名片下载次数" align="left" ></el-table-column>

          <el-table-column prop="goodsCardDownloadCount" label="商品名片下载次数" align="left"></el-table-column>
       
        <el-table-column prop="storeCardDownloadCount" label="店铺名片下载次数" align="left" ></el-table-column>
         <el-table-column prop="sumCount" label="总下载次数" align="left" ></el-table-column> -->
        </el-table>

        <div class="block" style="margin-top:10px">
          <el-pagination
            @size-change="handleSizeChangetwo"
            @current-change="handleCurrentChangetwo"
            :page-sizes="[10, 20, 30, 50, 100, 150, 200]"
            :current-page="listQuerytwo.current"
            :page-size="listQuerytwo.size"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Sortable from 'sortablejs';
import { getmemberrule, getMemberExcel } from '@/api/membergrade';
import {
  memberManage,
  updatememberinfo,
  delmemberinfo,
  queryStoreOrgseq,
  getGraCount,
  queryMemberDetail,
} from '@/api/memberinfo';
import {
  getWarZoneCount,
  getBase,
  getStore,
  exportWarZoneDate,
  exportBase,
  exportStore,
} from '@/api/businessActivity';
import qs from 'qs';
export default {
  data() {
    return {
      colone: [
        {
          label: '排名',
          prop: 'grade',
        },
        {
          label: '大区名称',
          prop: 'upOrgZone',
        },
        {
          label: '活动名片下载次数',
          prop: 'activityCardDownloadCount',
          sortable: 'activityCardDownloadCount',
        },
        {
          label: '商品名片下载次数',
          prop: 'goodsCardDownloadCount',
          sortable: 'goodsCardDownloadCount',
        },
        {
          label: '店铺名片下载次数',
          prop: 'storeCardDownloadCount',
          sortable: 'storeCardDownloadCount',
        },
        {
          label: '总下载次数',
          prop: 'sumCount',
          sortable: 'sumCount',
        },
      ],
      dropColone: [
        {
          label: '排名',
          prop: 'grade',
        },
        {
          label: '大区名称',
          prop: 'upOrgZone',
        },
        {
          label: '活动名片下载次数',
          prop: 'activityCardDownloadCount',
          sortable: 'activityCardDownloadCount',
        },
        {
          label: '商品名片下载次数',
          prop: 'goodsCardDownloadCount',
          sortable: 'goodsCardDownloadCount',
        },
        {
          label: '店铺名片下载次数',
          prop: 'storeCardDownloadCount',
          sortable: 'storeCardDownloadCount',
        },
        {
          label: '总下载次数',
          prop: 'sumCount',
          sortable: 'sumCount',
        },
      ],
      col: [
        {
          label: '排名',
          prop: 'grade',
        },
        {
          label: '大区名称',
          prop: 'upOrgZone',
        },
        {
          label: '营销区域名称',
          prop: 'baseName',
        },
        {
          label: '店铺授权编码',
          prop: 'authCode',
        },
        {
          label: '店铺名称',
          prop: 'storeName',
        },
        {
          label: '活动名片下载次数',
          prop: 'activityCardDownloadCount',
          sortable: 'activityCardDownloadCount',
        },
        {
          label: '商品名片下载次数',
          prop: 'goodsCardDownloadCount',
          sortable: 'goodsCardDownloadCount',
        },
        {
          label: '店铺名片下载次数',
          prop: 'storeCardDownloadCount',
          sortable: 'storeCardDownloadCount',
        },
        {
          label: '总下载次数',
          prop: 'sumCount',
          sortable: 'sumCount',
        },
      ],
      dropCol: [
        // {
        //     label: '序号',
        //     prop: 'index'
        //   },
        {
          label: '排名',
          prop: 'grade',
        },
        {
          label: '大区名称',
          prop: 'upOrgZone',
        },
        {
          label: '营销区域名称',
          prop: 'baseName',
        },
        {
          label: '店铺授权编码',
          prop: 'authCode',
        },
        {
          label: '店铺名称',
          prop: 'storeName',
        },
        {
          label: '活动名片下载次数',
          prop: 'activityCardDownloadCount',
          sortable: 'activityCardDownloadCount',
        },
        {
          label: '商品名片下载次数',
          prop: 'goodsCardDownloadCount',
          sortable: 'goodsCardDownloadCount',
        },
        {
          label: '店铺名片下载次数',
          prop: 'storeCardDownloadCount',
          sortable: 'storeCardDownloadCount',
        },
        {
          label: '总下载次数',
          prop: 'sumCount',
          sortable: 'sumCount',
        },
      ],
      coltwo: [
        {
          label: '排名',
          prop: 'grade',
        },
        {
          label: '大区名称',
          prop: 'upOrgZone',
        },
        {
          label: '营销区域名称',
          prop: 'baseName',
        },
        {
          label: '活动名片下载次数',
          prop: 'activityCardDownloadCount',
          sortable: 'activityCardDownloadCount',
        },
        {
          label: '商品名片下载次数',
          prop: 'goodsCardDownloadCount',
          sortable: 'goodsCardDownloadCount',
        },
        {
          label: '店铺名片下载次数',
          prop: 'storeCardDownloadCount',
          sortable: 'storeCardDownloadCount',
        },
        {
          label: '总下载次数',
          prop: 'sumCount',
          sortable: 'sumCount',
        },
      ],
      dropColtwo: [
        {
          label: '排名',
          prop: 'grade',
        },
        {
          label: '大区名称',
          prop: 'upOrgZone',
        },
        {
          label: '营销区域名称',
          prop: 'baseName',
        },
        {
          label: '活动名片下载次数',
          prop: 'activityCardDownloadCount',
          sortable: 'activityCardDownloadCount',
        },
        {
          label: '商品名片下载次数',
          prop: 'goodsCardDownloadCount',
          sortable: 'goodsCardDownloadCount',
        },
        {
          label: '店铺名片下载次数',
          prop: 'storeCardDownloadCount',
          sortable: 'storeCardDownloadCount',
        },
        {
          label: '总下载次数',
          prop: 'sumCount',
          sortable: 'sumCount',
        },
      ],
      isActive: false,
      items: ['大区排名', '营销区域排名', '店铺排名'],
      paiming: true,
      paimingone: false,
      paimingtwo: false,

      loading: true,
      options: [],
      checkedarr: [],

      dataorg: [],
      defaultProps: {
        children: 'children',
        label: '+',
        isLeaf: false,
      },
      listQuery: {
        current: 1,
        size: 100,
      },
      listQueryone: {
        current: 1,
        size: 10,
      },
      listQuerytwo: {
        current: 1,
        size: 10,
      },
      memberList: {},
      detailform: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: '',
      },
      dialogVisibledetail: false,
      total: 0,
      formInline: {
        sort: 1,
        upOrgZone: '',
        baseName: '',
        authCode: '',
        storeName: '',
      },
      totalData: {
        total: 0,
        strongBindMemberSum: 0,
        weakMemberSum: 0,
      },
      data5: [],
      data3: [],
      data4: [],
      resone: [],
      objone: {},
      tableData: [],
      multipleSelection: [],
      radio: '',
      rolefenid: '',
      selected: {},
      form: {
        memberName: '',
        sex: '',
        memberType: '',
        membercardId: '',
        cellPhoneNo: '',
      },
      type: '1',
      orgList: {},
      roleid: '',
      dialogVisibleone: false,
      dialogVisibletwo: false,
      dialogVisible: false,
      ruledata: [],
    };
  },
  mounted() {
    this.checkedarr = [];
    this.logininfo = localStorage.getItem('logininfo');

    this.orgList = JSON.parse(this.logininfo).orgList;
    this.formInline.orgName = this.orgList[0].orgName;
    console.log(this.orgList, '000333');
    this.resone = this.orgList[0].orgSeq;
    this.checkedarr.push(this.resone);
    console.log(this.resone, '000388');
    this._memberManage();
    this._getGraCount();
    this._getmemberinfo();
    // this.isActive=0
    document.body.ondrop = function(event) {
      event.preventDefault();
      event.stopPropagation();
    };
    // this.rowDrop()
    // this.columnDrop();
    this.columnDropone();
    // this.columnDroptwo();
  },

  methods: {
    columnDrop() {
      console.log(document);
      const wrapperTr = document.querySelector('.el-table__header-wrapper tr');
      this.sortable = Sortable.create(wrapperTr, {
        animation: 180,
        delay: 0,
        onEnd: (evt) => {
          const oldItem = this.dropCol[evt.oldIndex];
          this.dropCol.splice(evt.oldIndex, 1);
          this.dropCol.splice(evt.newIndex, 0, oldItem);
        },
      });
    },
    columnDropone() {
      const wrapperTrone = document.querySelector(
        '.el-table__header-wrapper tr'
      );
      this.sortable = Sortable.create(wrapperTrone, {
        animation: 180,
        delay: 0,
        onEnd: (evt) => {
          const oldItem = this.dropColone[evt.oldIndex];
          this.dropColone.splice(evt.oldIndex, 1);
          this.dropColone.splice(evt.newIndex, 0, oldItem);
        },
      });
    },
    columnDroptwo() {
      const wrapperTrtwo = document.querySelector(
        '.el-table__header-wrapper tr'
      );
      this.sortable = Sortable.create(wrapperTrtwo, {
        animation: 180,
        delay: 0,
        onEnd: (evt) => {
          const oldItem = this.dropColtwo[evt.oldIndex];
          this.dropColtwo.splice(evt.oldIndex, 1);
          this.dropColtwo.splice(evt.newIndex, 0, oldItem);
        },
      });
    },

    //    mouseEnter(index){
    //     this.isActive = index;
    //   },
    //   mouseLeave(){
    //        this.isActive=null;
    //   },
    exportExcel() {
      let data = {
        warZoneName: this.formInline.upOrgZone,
      };
      exportWarZoneDate(data)
        .then((res) => {
          const link = document.createElement('a');
          let blob = new Blob([res], { type: 'application/vnd.ms-excel' });
          link.style.display = 'none';
          //设置连接
          link.href = URL.createObjectURL(blob);
          link.download = '商家活动参与度统计表（大区）.xlsx';
          document.body.appendChild(link);
          //模拟点击事件
          link.click();
        })
        .catch((err) => {
          console.log(err);
        });
    },
    exportExcelone() {
      let data = {
        warZoneName: this.formInline.upOrgZone,
        baseName: this.formInline.baseName,
      };
      exportBase(data)
        .then((res) => {
          const link = document.createElement('a');
          let blob = new Blob([res], { type: 'application/vnd.ms-excel' });
          link.style.display = 'none';
          //设置连接
          link.href = URL.createObjectURL(blob);
          link.download = '商家活动参与度统计表（营销区域）.xlsx';
          document.body.appendChild(link);
          //模拟点击事件
          link.click();
        })
        .catch((err) => {
          console.log(err);
        });
    },
    exportExceltwo() {
      let data = {
        warZoneName: this.formInline.upOrgZone,
        baseName: this.formInline.baseName,
        authCode: this.formInline.authCode,
        storeName: this.formInline.storeName,
      };
      exportStore(data)
        .then((res) => {
          const link = document.createElement('a');
          let blob = new Blob([res], { type: 'application/vnd.ms-excel' });
          link.style.display = 'none';
          //设置连接
          link.href = URL.createObjectURL(blob);
          link.download = '商家活动参与度统计表（店铺）.xlsx';
          document.body.appendChild(link);
          //模拟点击事件
          link.click();
        })
        .catch((err) => {
          console.log(err);
        });
    },
    kong() {
      this.formInline.upOrgZone = '';
      this.formInline.sort = 1;
    },
    kongone() {
      this.formInline.upOrgZone = '';
      this.formInline.baseName = '';
      this.formInline.sort = 1;
    },
    kongtwo() {
      this.formInline.sort = 1;
      this.formInline.authCode = '';
      this.formInline.storeName = '';
      this.formInline.upOrgZone = '';
      this.formInline.baseName = '';
    },
    handleNodeClickone(data, checked, node) {
      console.log(data, checked, node, 'ioioio');
      this.formInline.orgName = data.orgName;
    },
    handleNodeClick(data, checked, node) {
      console.log(data, checked, node, '111');
      if (checked === true) {
        this.checkedId = data.orgSeq;
        this.$refs.tree.setCheckedKeys([data.orgSeq]);
      } else {
        if (this.checkedId == data.orgSeq) {
          this.$refs.tree.setCheckedKeys([data.orgSeq]);
        }
      }
      this.resone = this.$refs.tree.getCheckedKeys();
    },
    // },
    surefenrole() {
      this._memberManage();
      this.resone = this.resone[0];
      this._getGraCount();
      console.log(this.resone, 'io88');
      this.dialogVisible = !this.dialogVisible;
    },
    search() {
      let data = {
        size: this.listQuery.size,
        current: this.listQuery.current,
        ascs: [],
        descs: [],
        condition: {
          warZoneName: this.formInline.upOrgZone,
          sort: this.formInline.sort,
        },
      };
      getWarZoneCount(data).then((res) => {
        this.tableData = res.records;
        this.total = res.total;
      });
    },
    searchone() {
      let data = {
        size: this.listQueryone.size,
        current: this.listQueryone.current,
        ascs: [],
        descs: [],
        condition: {
          warZoneName: this.formInline.upOrgZone,
          baseName: this.formInline.baseName,
          sort: this.formInline.sort,
        },
      };
      getBase(data).then((res) => {
        this.tableData = res.records;
        this.total = res.total;
      });
    },
    searchtwo() {
      let data = {
        size: this.listQuerytwo.size,
        current: this.listQuerytwo.current,
        ascs: [],
        descs: [],
        condition: {
          sort: this.formInline.sort,
          warZoneName: this.formInline.upOrgZone,
          authCode: this.formInline.authCode,
          storeName: this.formInline.storeName,
          baseName: this.formInline.baseName,
        },
      };
      getStore(data).then((res) => {
        this.tableData = res.records;
        this.total = res.total;
      });
    },

    handledelete(v) {
      let data = {
        memberId: v.memberId,
      };
      this.$confirm('确认删除吗？').then((_) => {
        delmemberinfo(qs.stringify(data)).then((res) => {
          this.$message({
            showClose: true,
            message: '删除成功',
            type: 'success',
          });
          this._memberManage();
        });
      });
    },
    add() {
      this.logininfo = localStorage.getItem('logininfo');
      //   console.log(this.logininfo.userId, "000");
      this.orgList = JSON.parse(this.logininfo).orgList;
      console.log(this.orgList, '000');
      //   console.log(this.logininfo.userId, "000");
      //   this.logininfo.orgList.forEach((item, i) => {
      //     this.dataorg.push(item);
      //   });
      //   console.log(this.dataorg, "000");

      this.dialogVisible = !this.dialogVisible;
      this._queryStoreOrgseq();
    },
    mouseEnter(index) {
      this.formInline.sort = 1;
      this.isActive = index;
      if (index == 0) {
        this.type = '1';

        (this.paiming = true),
          (this.paimingone = false),
          (this.paimingtwo = false),
          this._memberManage();
      } else if (index == 1) {
        this.type = '2';

        (this.paiming = false),
          (this.paimingone = true),
          (this.paimingtwo = false),
          this._memberManageone();
      } else if (index == 2) {
        this.type = '3';

        (this.paiming = false),
          (this.paimingone = false),
          (this.paimingtwo = true),
          this._memberManagetwo();
      }
    },
    // clicktwo() {
    //   this.type = "2";

    //     this.paiming=false,
    //    this.paimingone=true,
    //     this.paimingtwo=false,
    //   this._memberManageone();
    // },
    // clickthree() {
    //   this.type = "3";

    //       this.paiming=false,
    //    this.paimingone=false,
    //     this.paimingtwo=true,
    //   this._memberManagetwo();
    // },
    _memberManage() {
      let data = {
        size: this.listQuery.size,
        current: this.listQuery.current,
        ascs: [],
        descs: [],
        condition: {
          warZoneName: this.formInline.upOrgZone,
          sort: this.formInline.sort,
        },
      };
      getWarZoneCount(data).then((res) => {
        this.loading = false;
        this.tableData = res.records;
        this.total = res.total;
      });
    },
    _memberManageone() {
      let data = {
        size: this.listQueryone.size,
        current: this.listQueryone.current,
        ascs: [],
        descs: [],
        condition: {
          sort: this.formInline.sort,
          warZoneName: this.formInline.upOrgZone,
          baseName: this.formInline.baseName,
        },
      };
      getBase(data).then((res) => {
        this.loading = false;
        this.tableData = res.records;
        this.total = res.total;
      });
    },
    _memberManagetwo() {
      let data = {
        size: this.listQuerytwo.size,
        current: this.listQuerytwo.current,
        ascs: [],
        descs: [],
        condition: {
          sort: this.formInline.sort,
          warZoneName: this.formInline.upOrgZone,
          authCode: this.formInline.authCode,
          storeName: this.formInline.storeName,
          baseName: this.formInline.baseName,
        },
      };
      getStore(data).then((res) => {
        this.loading = false;
        this.tableData = res.records;
        this.total = res.total;
      });
    },
    _queryStoreOrgseq() {
      let data = {
        orgSeq: this.orgList[0].orgSeq,
      };
      queryStoreOrgseq(data).then((res) => {
        this.dataorg = res.records;
        console.log(data);
      });
    },
    _getGraCount() {
      console.log(this.resone, 'io555');
      let data = {
        orgSeq: this.resone,
      };
      getGraCount(data).then((res) => {
        console.log(data);
        this.totalData = res.result;
      });
    },
    edit(v) {
      this.$router.push({
        name: 'memberInfodetail',
        params: {
          v: v,
        },
      });
      //   console.log(v, "po");
      //   this.dialogVisibledetail = !this.dialogVisibledetail;
      //   let data = {
      //     memberId: v.memberId
      //   };
      //   queryMemberDetail(data).then(res => {
      //     console.log(data);
      //     this.memberList = res.result;
      //     res.records[0].sex=1?this.memberList.sex = "男":this.memberList.sex = "女";
      //   });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.listQuery.size = val;
      this._memberManage();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.listQuery.current = val;
      this._memberManage();
    },
    handleSizeChangeone(val) {
      console.log(`每页 ${val} 条`);
      this.listQueryone.size = val;
      this._memberManageone();
    },
    handleCurrentChangeone(val) {
      console.log(`当前页: ${val}`);
      this.listQueryone.current = val;
      this._memberManageone();
    },
    handleSizeChangetwo(val) {
      console.log(`每页 ${val} 条`);
      this.listQuerytwo.size = val;
      this._memberManagetwo();
    },
    handleCurrentChangetwo(val) {
      console.log(`当前页: ${val}`);
      this.listQuerytwo.current = val;
      this._memberManagetwo();
    },
    indexMethod(index) {
      let curpage = this.listQuery.current; //单前页码，具体看组件取值
      let limitpage = this.listQuery.size; //每页条数，具体是组件取值
      return index + 1 + (curpage - 1) * limitpage;
    },
    _getmemberinfo() {
      let data = {
        size: 99,
        current: 1,
        condition: {},
        ascs: [],
        descs: [],
      };
      getmemberrule(data).then((res) => {
        this.options = res.records;
      });
    },
    handleNodeClick3(data) {
      console.log(data.children, 'children');
      console.log(data.level, 'level');
      //判断有children并且children为空
      if (
        data.level > 0 &&
        data.level < 4
        // && data.level.length === 0
      ) {
        let data2 = {
          orgSeq: data.orgSeq,
        };
        queryStoreOrgseq(data2)
          .then((response) => {
            data.children = response.records[0].children;
            //因为我们只有二级，所以我已经让第二级不用去请求，直接去掉那个三角icon
            data.children.forEach(function(value, i) {
              value.level < 3 ? true : false;
            });
            loadingInstance.close();
          })
          .catch(() => {
            this.loading = false;
          });
        // this.treeData[data.$treeNodeId - 1].children = treeData1
        // data.children = this.treeData1[0].children
      }
    },
    handleNodeClick2(data) {
      console.log('node', data);
    },
    // 异步树叶子节点懒加载逻辑
    loadNode(node, resolve) {
      console.log(node);
      console.log(resolve);
      // 一级节点处理
      if (node.level === 0) {
        this.requestTree(resolve);
      }
      // 其余节点处理
      if (node.level >= 1) {
        // 注意！把resolve传到你自己的异步中去
        this.getIndex(node, resolve);
      }
    },
    // 异步加载叶子节点数据函数
    getIndex(node, resolve) {
      var param = {
        code: '002',
        provinceId: node.data.regionCode,
      };
      var url = '/base/inter';
      this.$ajax
        .post(url, param)
        .then((out) => {
          console.log(out.data.data);
          // 此处需要后台传过来一个值来判断每个节点有无子节点,实际项目中必须加上（如isRealLeaf），不传都默认为叶子节点
          //  out.data.data.forEach(value => {
          //   if (value.isRealLeaf === 'Y') {
          //     value.leaf = true//不为叶子节点
          //   } else {
          //     value.leaf = false//为叶子节点
          //   }
          // })
          let data = out.data.data;
          resolve(data);
        })
        .catch((error) => {});
    },
    // 首次加载一级节点数据函数
    requestTree(resolve) {
      var param = {
        code: '001',
      };
      var url = '/base/inter';
      this.$ajax
        .post(url, param)
        .then((out) => {
          console.log(out.data.data);
          // 此处需要后台传过来一个值来判断每个节点有无子节点,实际项目中必须加上（如isRealLeaf），不传都默认为叶子节点
          //  out.data.data.forEach(value => {
          //   if (value.isRealLeaf === 'Y') {
          //     value.leaf = true//不为叶子节点
          //   } else {
          //     value.leaf = false//为叶子节点
          //   }
          // })
          let data = out.data.data;
          resolve(data);
        })
        .catch((error) => {});
    },
    handleSort(val) {
      let sortModel = '';
      if (val.order === 'ascending') {
        sortModel = 'ASC';
        if (val.prop == 'activityCardDownloadCount') {
          this.formInline.sort = 2;
          this.search();
        }
        if (val.prop == 'goodsCardDownloadCount') {
          this.formInline.sort = 4;
          this.search();
        }
        if (val.prop == 'storeCardDownloadCount') {
          this.formInline.sort = 6;
          this.search();
        }
        if (val.prop == 'sumCount') {
          this.formInline.sort = 8;
          this.search();
        }
      } else if (val.order === 'descending') {
        sortModel = 'DESC';
        if (val.prop == 'activityCardDownloadCount') {
          this.formInline.sort = 3;
          this.search();
        }
        if (val.prop == 'goodsCardDownloadCount') {
          this.formInline.sort = 5;
          this.search();
        }
        if (val.prop == 'storeCardDownloadCount') {
          this.formInline.sort = 7;
          this.search();
        }
        if (val.prop == 'sumCount') {
          this.formInline.sort = 9;
          this.search();
        }
      }
    },
    handleSortone(val) {
      let sortModel = '';
      if (val.order === 'ascending') {
        sortModel = 'ASC';
        if (val.prop == 'activityCardDownloadCount') {
          this.formInline.sort = 2;
          this.searchone();
        }
        if (val.prop == 'goodsCardDownloadCount') {
          this.formInline.sort = 4;
          this.searchone();
        }
        if (val.prop == 'storeCardDownloadCount') {
          this.formInline.sort = 6;
          this.searchone();
        }
        if (val.prop == 'sumCount') {
          this.formInline.sort = 8;
          this.searchone();
        }
      } else if (val.order === 'descending') {
        sortModel = 'DESC';
        if (val.prop == 'activityCardDownloadCount') {
          this.formInline.sort = 3;
          this.searchone();
        }
        if (val.prop == 'goodsCardDownloadCount') {
          this.formInline.sort = 5;
          this.searchone();
        }
        if (val.prop == 'storeCardDownloadCount') {
          this.formInline.sort = 7;
          this.searchone();
        }
        if (val.prop == 'sumCount') {
          this.formInline.sort = 9;
          this.searchone();
        }
      }
    },
    handleSorttwo(val) {
      let sortModel = '';
      if (val.order === 'ascending') {
        sortModel = 'ASC';
        if (val.prop == 'activityCardDownloadCount') {
          this.formInline.sort = 2;
          this.searchtwo();
        }
        if (val.prop == 'goodsCardDownloadCount') {
          this.formInline.sort = 4;
          this.searchtwo();
        }
        if (val.prop == 'storeCardDownloadCount') {
          this.formInline.sort = 6;
          this.searchtwo();
        }
        if (val.prop == 'sumCount') {
          this.formInline.sort = 8;
          this.searchtwo();
        }
      } else if (val.order === 'descending') {
        sortModel = 'DESC';
        if (val.prop == 'activityCardDownloadCount') {
          this.formInline.sort = 3;
          this.searchtwo();
        }
        if (val.prop == 'goodsCardDownloadCount') {
          this.formInline.sort = 5;
          this.searchtwo();
        }
        if (val.prop == 'storeCardDownloadCount') {
          this.formInline.sort = 7;
          this.searchtwo();
        }
        if (val.prop == 'sumCount') {
          this.formInline.sort = 9;
          this.searchtwo();
        }
      }
    },
  },
};
</script>
<style lang="less" scoped>
.toptitle {
  border: 1px solid #e0e0e0;
  border-bottom: 2px solid #188097;
  background: #f5f5f5;
  line-height: 35px;
  margin-bottom: 10px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: bold;
}
.limttable {
  width: 500px;
  float: left;
}

.limttree {
  display: inline-block;

  border-top: 48px solid rgb(238, 241, 246);
  width: 206px;
  margin-left: 150px;
}
.demo-form-inline {
  //   border: 1px solid #ebeef5;
  padding: 20px 10px 3px 30px;
  margin-bottom: 25px;
}
.toptitle {
  border: 1px solid #e0e0e0;
  border-bottom: 2px solid #188097;
  background: #f5f5f5;
  line-height: 35px;
  margin-bottom: 10px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: bold;
}
.limttreecontain {
  height: 260px;
  width: 200px;
  overflow: scroll;
  border: 1px solid #ccc;
}
.order_content {
  width: 350px;
  height: 120px;
  margin: 0 auto;
  text-align: center;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}
// .order_content .order_total_title {
//   color: #000;
// }
.order_content .order_total_info {
  margin: 10px 0;
}
.order_content .order_data {
  font-size: 1.4em;
  font-weight: bold;
}
.order_content .compared_title {
  font-size: 0.8em;
  color: #999;
}
.demo-form-inline .el-form-item {
  margin-bottom: 0px;
}
.el-row {
  margin-bottom: 0px !important;
}
.active .order_total_title {
  background: #409eff;
  color: #fff !important; // 选中字体背景跟着改变
}
</style>
